package iso3.pt.action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import iso3.pt.model.*;
import iso3.pt.service.PtDaoService;
import iso3.pt.service.PtService;

import java.util.Map;
import java.util.Set;


/*
 * EN DESARROLLO
 * 
 * @author ander
 */
public class LoadStudent  extends ActionSupport
{
	private static final long serialVersionUID = 1L;

	// Datos preparados para que los lea el JSP
	private Alumno alumno = null;
	private Set<Asignatura> subjects = null;

	
	public String execute() throws Exception
	{
		// Preparar alumno
		@SuppressWarnings("rawtypes")
		Map session = ActionContext.getContext().getSession();
		alumno = (Alumno) session.get("alumno");
		
		// Preparar asignaturas
		PtService service = new PtDaoService();
		subjects = (Set<Asignatura>) service.getAsignaturas(alumno.getDni());

		return SUCCESS;
	}

	public Alumno getAlumno()
	{
		return alumno;
	}

	public void setAlumno(Alumno alumno)
	{
		this.alumno = alumno;
	}

	public Set<Asignatura> getSubjects()
	{
		return subjects;
	}

	public void setSubjects(Set<Asignatura> subjects)
	{
		this.subjects = subjects;
	}
	
	
}